<template>
  <div class="app-container">
    <div class="filter-container bor-container">
      <el-form size="mini" :inline="true">
        <!--<el-form-item>
          <el-select placeholder="公告类型" @change="query()" clearable v-model="formInline.kind">
            <el-option value="1" label="使用帮助"></el-option>
            <el-option value="2" label="陪玩管理规则"></el-option>
            <el-option value="3" label="公会管理规则"></el-option>
            <el-option value="4" label="平台通知"></el-option>
            <el-option value="5" label="活动公告"></el-option>
          </el-select>
        </el-form-item>-->
        <!-- <el-button size="mini" @click="query()" icon="el-icon-search">查询</el-button>-->
      </el-form>
    </div>
    <el-table class="per_tb" stripe v-loading="loading" border :data="tableData">
      <el-table-column
        type="index"
        width="50"
        label="序号">
      </el-table-column>

      <el-table-column prop="url" label="请求接口">
      </el-table-column>

      <el-table-column prop="ip" label="请求IP">
      </el-table-column>

      <el-table-column prop="requestTime" label="请求时间">
      </el-table-column>

      <el-table-column prop="method" label="请求方法">
      </el-table-column>

      <el-table-column prop="createTime" label="创建时间">
      </el-table-column>

    </el-table>
    <el-pagination
      class="pagination-right"
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="formInline.pageNum"
      :page-sizes="[10]"
      :page-size="formInline.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="formInline.total">
    </el-pagination>
  </div>
</template>
<script>
  import { getLogListAPI} from "@/api/log";
  import { mapGetters } from 'vuex'
  export default {
    name: 'Blog',
    data() {
      return {
        value: '',
        data:'',
        formInline: {
          page:1,
          pageSize: 10,
          pageNum: 1,
          total: 0,
          kind:''
        },
        editUser: null, // 编辑时传入的对象
        loading: false,
        tableData: [],
        dialog: {
          status: false
        },
        dialogadd: {
          status: false
        }
      }
    },
    computed: {
      ...mapGetters([
        'buttons',
      ])
    },
    mounted() {
      this.getList()
    },
    methods: {
      // 点击查询事件
      query() {
        this.formInline.pageNum = 1
        this.getList()
      },
      // 操作成功的钩子用来更新列表
      success() {
        this.getList()
      },
      // 关闭弹窗返回的钩子
      close() {
        this.dialog.status = false;
        this.dialogadd.status = false;
      },

      // pageSize发生改变触发
      handleSizeChange(val) {
        this.pageNum = 1
        this.pageSize = val
        this.getList()
      },
      // pageNum 发生改变触发
      handleCurrentChange(val) {
        this.formInline.pageNum = val
        this.getList()
      },
      // 获取日志列表
      getList() {
        this.loading = true
        getLogListAPI(this.formInline).then(res => {
          debugger
          this.loading = false
          if (res.code === 200) {
            this.tableData = res.data.list
            this.formInline.total = res.data.total
            this.dialogadd.status = false
          } else {
            this.$message.error(res.message)
          }
        })
      }
    }
  }
</script>
<style>
</style>

